﻿using System;
using System.Collections;
using System.Collections.Generic;
using Gameplay.PVE.Survivor;
using OWL.Rendering.HRP;
using UnityEngine;
using Yoozoo.HRP.Runtime;

public class BattleRegionData : MonoBehaviour
{
    public EBattleRegionShapeType shape = EBattleRegionShapeType.Circle;
    public float shapeParam1;
    public float shapeParam2;

    private void OnDrawGizmos()
    {
        if (shape == EBattleRegionShapeType.Circle)
        {
            var radius = shapeParam1;
            Gizmos.color = Color.red;
            var count = 30;
            for (int i = 0; i < count; i++)
            {
                var interval = 360 / count;
                var angle = i * interval;
                var dir = Quaternion.Euler(0, angle, 0) * transform.forward;
                var dir2 = Quaternion.Euler(0, angle + interval, 0) * transform.forward;
                var startPosition = transform.position + new Vector3(0, 0.3f, 0);
                Gizmos.DrawLine(startPosition + dir * radius, startPosition + dir2 * radius);
            }
        }
        else if (shape == EBattleRegionShapeType.Rect)
        {
            var width = shapeParam1;
            var height = shapeParam2;
            Gizmos.color = Color.red;
            var center = transform.position;
            var forward = transform.forward;
            var right = transform.right;
            var p1 = center + right * width / 2 + height * forward / 2 + new Vector3(0,0.3f,0);
            var p2 = center + right * width / 2 - height * forward / 2 + new Vector3(0,0.3f,0);
            var p3 = center - right * width / 2 - height * forward / 2 + new Vector3(0,0.3f,0);
            var p4 = center - right * width / 2 + height * forward / 2 + new Vector3(0,0.3f,0);
            Gizmos.DrawLine(p1,p2);
            Gizmos.DrawLine(p2,p3);
            Gizmos.DrawLine(p3,p4);
            Gizmos.DrawLine(p4,p1);
        }
    }
}
